package com.yunyouyi.cpicture.domain.user.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunyouyi.cpicture.domain.user.entity.User;
import com.yunyouyi.cpicture.interfaces.dto.user.UserLoginDTO;
import com.yunyouyi.cpicture.interfaces.dto.user.UserQueryDTO;
import com.yunyouyi.cpicture.interfaces.dto.user.UserRegisterDTO;
import com.yunyouyi.cpicture.interfaces.vo.user.UserLoginVO;
import com.yunyouyi.cpicture.interfaces.vo.user.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;

/**
* @author yunyouyi
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-03-31 15:14:30
*/
public interface UserDomainService {

    /**
     * 用户注册
     * @param userRegisterDTO
     * @return
     */
    long userRegister(UserRegisterDTO userRegisterDTO);

    /**
     * 用户登录
     * @param userLoginDTO
     * @return 脱敏后的用户信息
     */
    UserLoginVO userLogin(UserLoginDTO userLoginDTO, HttpServletRequest request);

    /**
     * 获取当前登录用户
     * @param request
     * @return 当前登录用户
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    UserLoginVO getLoginUserVO(User user);

    /**
     * 获得脱敏后的用户
     * @param user
     * @return 脱敏后的用户信息
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏用户列表
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取加密密码
     * @param userPassword
     * @return
     */
    String getEncryptPassword(String userPassword);

    /**
     * 用户退出登录
     * @param request
     * @return
     */
    Boolean userLogout(HttpServletRequest request);

    /**
     * 获得查询
     * @param userQueryDTO
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryDTO userQueryDTO);

    Boolean removeById(Long id);

    boolean updateById(User user);

    User getById(long id);

    Page<User> page(Page<User> userPage, QueryWrapper<User> queryWrapper);

    List<User> listByIds(Set<Long> userIdSet);

    boolean saveUser(User userEntity);
}
